<!DOCTYPE html>
<html lang="en" ng-app="KingLogin">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>环境云平台登录</title>

    <link href='https://fonts.lug.ustc.edu.cn/css?family=Roboto:400,100,100italic,300,300italic,400italic,500,500italic,700,700italic,900italic,900&subset=latin,greek,greek-ext,vietnamese,cyrillic-ext,latin-ext,cyrillic'
          rel='stylesheet' type='text/css'>

    <link rel="icon" type="image/png" sizes="16x16" href="assets/img/favicon-16x16.png">
    <link rel="icon" type="image/png" sizes="32x32" href="assets/img/favicon-32x32.png">
    <link rel="icon" type="image/png" sizes="96x96" href="assets/img/favicon-96x96.png">

    <!-- build:css({.tmp/serve,src}) styles/vendor.css -->
    <!-- bower:css -->
    <!-- run `gulp inject` to automatically populate bower styles dependencies -->
    <!-- endbower -->
    <!-- endbuild -->

    <!-- build:css({.tmp/serve,src}) styles/auth.css -->
    <!-- inject:css -->
    <!-- css files will be automatically insert here -->
    <!-- endinject -->
    <!-- endbuild -->
</head>
<body>
<main class="auth-main" ng-controller="LoginController" ng-if="show">
    <div class="auth-block">
        <h1>登录环境云平台</h1>

        <form class="form-horizontal" ng-submit="save()">
            <div class="form-group">
                <label for="username" class="col-sm-2 control-label">用户名</label>

                <div class="col-sm-10">
                    <input type="text" class="form-control" id="username" placeholder="用户名" ng-model="user.username"
                           required>
                </div>
            </div>
            <div class="form-group">
                <label for="password" class="col-sm-2 control-label">密码</label>

                <div class="col-sm-10">
                    <input type="password" class="form-control" id="password" placeholder="密码" ng-model="user.password"
                           required>
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-offset-2 col-sm-10">
                    <button type="submit" class="btn btn-default btn-auth">登录</button>
                    <a href="reg.html" class="forgot-pass">注册</a>
                </div>
            </div>
        </form>

<!--         <div class="auth-sep"><span><span>通过其他方式登录</span></span></div>

        <div class="al-share-auth">
            <ul class="al-share clearfix">
                <li><i class="socicon socicon-facebook" title="Share on Facebook"></i></li>
                <li><i class="socicon socicon-twitter" title="Share on Twitter"></i></li>
                <li><i class="socicon socicon-google" title="Share on Google Plus"></i></li>
            </ul>
        </div> -->
    </div>
</main>
<div id="preloader" ng-show="!show">
    <div></div>
</div>
<!-- build:js(src) scripts/vendor.js -->
<!-- bower:js -->
<!-- run `gulp inject` to automatically populate bower script dependencies -->
<!-- endbower -->
<!-- endbuild -->

<script type="text/javascript">
    'use strict';

    angular.module('KingLogin', [
        'ngResource',
        'toastr',
    ]).run(function ($timeout, $rootScope) {
        $rootScope.show = true;

        // $timeout(function () {
        //     $rootScope.show = true;
        // },3000);
    });
</script>
<script type="text/javascript">
    (function () {
        'use strict';

        angular.module('KingLogin')
            .controller('LoginController', function ($scope, $resource, $window,toastr) {

                $scope.user = {};
                $scope.save = function () {
                    $resource('api/login', {}, {'login': {method: 'POST'}})
                        .login($scope.user, function (data) {
                            if (data.code == 0) {
                                $window.open('index.html', '_self');
                            }else{
                                toastr.warning(data.msg, "提示", {"progressBar": true,});
                            }
                        }, function (error) {
                            toastr.error(error, "提示", {"progressBar": true,});
                        });
                }
            });


    })();

</script>
<script type="text/javascript" color="255,192,203" opacity='0.9' zIndex="-1" count="200"
        src="//cdn.bootcss.com/canvas-nest.js/1.0.1/canvas-nest.min.js"></script>
</body>
</html>